package com.coe3.data;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class DataStorage {
	
	public static final String SEPARATE_AND = "&";
	public static final String APPLICATION_ID_RATING = "application_id_rating";
	public static final String LAST_APPLICATION_ID = "last_application_id";
	public static final String APPLICATION_ID = "application_id";
	public static final String APPLICATION_FILE_ID = "application_file_id";
	public static final String SERVICE_CODE = "service_code";
	public static final String KEYWORD = "keyword";
	
	public static final String KEY_UUID = "KEY_UUID";
	public static final String KEY_MACADDRESS = "KEY_MACADDRESS";
	
	public static final String KEY_IS_OPENAPP = "KEY_IS_OPENAPP";
	
	public static final String KEY_START_APP = "KEY_START_APP";
	
	public static Boolean setData(Context con, String variable, String data)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    prefs.edit().putString(variable, data).commit();
	    return true;
	}
	
	public static Boolean setStrData(Context con, String variable, String data)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    prefs.edit().putString(variable, data).commit();
	    return true;
	}
	
	public static Boolean setIntData(Context con, String variable, int data)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    prefs.edit().putInt(variable, data).commit();
	    return true;
	}
	
	public static Boolean setBoolData(Context con, String variable, Boolean data)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    prefs.edit().putBoolean(variable, data).commit();
	    return true;
	}
	
	public static String getStrData(Context con, String variable, String defaultValue)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    String data = prefs.getString(variable, defaultValue);
	    return data;
	}
	
	public static Boolean getBoolData(Context con, String variable, Boolean defaultValue)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    Boolean data = prefs.getBoolean(variable, defaultValue);
	    return data;
	}
	
	public static int getIntData(Context con, String variable, int defaultValue)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    int data = prefs.getInt(variable, defaultValue);
	    return data;
	}
	
	public static String getData(Context con, String variable, String defaultValue)
	{
	    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(con);
	    String data = prefs.getString(variable, defaultValue);
	    return data;
	}
	
}
